package org.jeecg.modules.system.allsmslog.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.system.allsmslog.entity.BikeSysSmsLog;
import org.jeecg.modules.system.allsmslog.mapper.BikeSysSmsLogMapper;
import org.jeecg.modules.system.allsmslog.service.BikeSysSmsLogService;
import org.jeecg.modules.utils.ExcelUtils;
import org.jeecg.modules.utils.RandomCodeUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 月月鸟
 */
@Service
public class BikeSysSmsLogServiceImpl implements BikeSysSmsLogService {
    @Resource
    private BikeSysSmsLogMapper bikeSysSmsLogMapper;
    /**
     * 新增短息记录
     *  mobile 手机号
     *  type 短信类型 1->注册, 2->忘记密码, 3->修改密码, 4->更换手机号, 5->手机号登录, 6->后台新增用户, 7->后台更换手机号 8-> 借车1.50小时短信提醒, 9->会员手动提醒, 9->借车记录手动提醒
     *  content 发送短信内容
     *  createBy 发送人账号
     * */
    @Override
    public void add(BikeSysSmsLog bikeSysSmsLog) {
        bikeSysSmsLog.setId(RandomCodeUtils.getUUID());
        bikeSysSmsLogMapper.add(bikeSysSmsLog);
    }
    /**
     * 短息发送记录分页查询
     * */
    @Override
    public Page<BikeSysSmsLog> pageList(BikeSysSmsLog bikeSysSmsLog, Page<BikeSysSmsLog> page) {
        List<BikeSysSmsLog> pageList = bikeSysSmsLogMapper.pageList(page, bikeSysSmsLog);
        return page.setRecords(pageList);

    }

    @Override
    public ModelAndView exportXls(HttpServletRequest request, BikeSysSmsLog bikeSysSmsLog) {
        List<BikeSysSmsLog> selectList = bikeSysSmsLogMapper.selectList(bikeSysSmsLog);
        return ExcelUtils.exportXls(request,selectList,BikeSysSmsLog.class,"短息发送记录表");
    }
}
